<svg
  class={className}
  {style}
  aria-hidden={!ariaLabel}
  aria-label={ariaLabel}
  ref:svg>
  <use xlink:href="{inline ? '' : '/icons.svg'}{href}" />
</svg>
<script>
  import { animate } from '../_utils/animate.js'
  import { store } from '../_store/store.js'

  const inlineSvgs = new Set(process.env.INLINE_SVGS)

  export default {
    data: () => ({
      className: '',
      style: '',
      ariaLabel: ''
    }),
    store: () => store,
    computed: {
      inline: ({ href }) => inlineSvgs.has(href)
    },
    methods: {
      animate (animation) {
        const { reduceMotion } = this.store.get()
        if (animation && !reduceMotion) {
          animate(this.refs.svg, animation)
        }
      }
    }
  }
</script>
